<?php

class admin_core_Faq_Form_Edit extends Engine_Core_Form
{
	/**
	 * @var core_Faq
	 */
	protected $_adapter;

	/**
	 * @return core_Faq
	 */
	protected function getAdapter()
	{
		if (empty($this->_adapter)) {
			$this->_adapter = core_Faq::getInstance();
		}

		return $this->_adapter;
	}

    public function init()
    {
        parent::init();

        $this->addElement('hidden', 'id', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('Int'),
            ),
        ));

        $this->addElement('text', 'title', array(
            'filters'    => array('StringTrim'),
            'required'   => true,
            'label'      => 'Title:',
        ));

        $this->addElement('textarea', 'question', array(
            'filters'    => array('StringTrim'),
            'required'   => true,
            'label'      => 'Question:',
            'rows'       => 5,
        ));

        $this->addElement('textarea', 'answer', array(
            'filters'    => array('StringTrim'),
            'required'   => true,
            'label'      => 'Answer:',
            'rows'       => 5,
        ));

        $this->addElement('submit', 'send', array(
            'required' => false,
            'ignore'   => true,
            'label'    => 'Save',
        ));
    }
}

